
import 'package:flutter/material.dart';

class WaitSeachPage extends StatefulWidget {
  const WaitSeachPage({Key key}) : super(key: key);

  @override
  _WaitSeachPageState createState() => _WaitSeachPageState();
}

class _WaitSeachPageState extends State<WaitSeachPage> {
  bool isSuffixVisible = true; //是否显示清除按钮
  TextEditingController controller = new TextEditingController();
  bool isContent = false; //显示数据或者显示提示

  // List<NoticesDataRecord> datas = new List();
  bool last = false;
  int pageIndex = 1;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          children: [
            Row(
              children: [
                Expanded(
                  child: Container(
                      margin: EdgeInsets.only(left: 20, right: 20, top: 10),
                      height: 40,
                      child: TextField(
                        // onChanged: (value) => editChange(value),
                        controller: controller,
                        decoration: InputDecoration(
                            counterText: '',
                            contentPadding: EdgeInsets.only(top: 8),
                            prefixIcon: Icon(Icons.search, color: Colors.grey),
                            suffixIcon: Offstage(
                              offstage: isSuffixVisible,
                              child: GestureDetector(
                                child: Icon(Icons.close, color: Colors.grey),
                                onTap: () {
                                  controller.clear();
                                  setState(() {
                                    isContent = false;
                                    isSuffixVisible = true;
                                  });
                                },
                              ),
                            ),
                            hintText: '请输入搜索内容',
                            border: InputBorder.none,
                            fillColor: Color(0xffF5F5F5),
                            filled: true,
                            enabledBorder: OutlineInputBorder(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(20)),
                                borderSide: BorderSide(
                                    color: Color(0xffF5F5F5), width: 3)),
                            focusedBorder: OutlineInputBorder(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(20)),
                                borderSide: BorderSide(
                                    color: Color(0xffF5F5F5), width: 3))),
                        maxLines: 1,
                        maxLength: 50,
                      )),
                ),
                Padding(
                    padding: EdgeInsets.only(right: 15, top: 10),
                    child: GestureDetector(
                      child: Text('取消'),
                      onTap: () => Navigator.pop(context),
                    ))
              ],
            ),
            Padding(
                padding: EdgeInsets.only(top: 10, bottom: 10),
                child: Divider(height: 1, color: Color(0xffF0F1F7))),
            Expanded(
                child: isContent
                    ?
                    // ListView.builder(
                    //     itemBuilder: (context,index) => items(index),
                    //     itemCount: datas.length,
                    //   shrinkWrap: true,
                    // )
                    Container(
                        child: Text('有数据'),
                      )
                    :Container(
                      child: Text('没有数据'),
                    )
                    //  ErrorMsgWidget.initWidget(state: 1),
                     
                     )
          ],
        ),
      ),
    );
  }
}
